RMarkdown

This is a markdown document in which code can be executed and output automatically included in the document. The document can be rendered as HTML or pdf.

An Example

The code chunk below will download the data we’ll use in this analysis, and show the first 5 rows.

library(plm)

url <- "https://github.com/Matt-Brigida/FFIEC_Call_Reports/raw/master/1_querying_data_and_analysis/analyses/panel_data_analysis/full_panel/1_panel_with_full_quarter_date/1_one_panel_all_models/full_panel.rds"

panel <- readRDS(url(url))
head(panel)
##             theindex_panel  quarter IDRSSD total_assets_lagged_1_year
## 37-20010331    20010331_37 20010331     37                         NA
## 37-20010630    20010630_37 20010630     37                         NA
## 37-20010930    20010930_37 20010930     37                         NA
## 37-20011231    20011231_37 20011231     37                         NA
## 37-20020331    20020331_37 20020331     37                      65486
## 37-20020630    20020630_37 20020630     37                      65427
##             total_equity_lagged_1_year total_assets t1_LR_lagged_1_year
## 37-20010331                         NA        65486                  NA
## 37-20010630                         NA        65427                  NA
## 37-20010930                         NA        65575                  NA
## 37-20011231                         NA        66624                  NA
## 37-20020331                      11424        68766              0.1798
## 37-20020630                      11543        69304              0.1780
##             t1_RBCR_lagged_1_year amt_CI_less_100_SB_loans_lagged_1_year
## 37-20010331                    NA                                     NA
## 37-20010630                    NA                                     NA
## 37-20010930                    NA                                     NA
## 37-20011231                    NA                                     NA
## 37-20020331                0.3245                                     NA
## 37-20020630                0.3012                                      0
##             amt_CI_100_250_SB_loans_lagged_1_year
## 37-20010331                                    NA
## 37-20010630                                    NA
## 37-20010930                                    NA
## 37-20011231                                    NA
## 37-20020331                                    NA
## 37-20020630                                     0
##             amt_CI_250_1000_SB_loans_lagged_1_year npa_30_89_lagged_1_year
## 37-20010331                                     NA                      NA
## 37-20010630                                     NA                      NA
## 37-20010930                                     NA                      NA
## 37-20011231                                     NA                      NA
## 37-20020331                                     NA                      85
## 37-20020630                                      0                       0
##             npa_90_plus_lagged_1_year npa_nonacc_lagged_1_year npa_30_89
## 37-20010331                        NA                       NA        85
## 37-20010630                        NA                       NA         0
## 37-20010930                        NA                       NA         0
## 37-20011231                        NA                       NA         5
## 37-20020331                         0                       18         0
## 37-20020630                         0                        0         0
##             npa_90_plus npa_nonacc net_income_lagged_1_year net_income
## 37-20010331           0         18                       NA        220
## 37-20010630           0          0                       NA        435
## 37-20010930          64         20                       NA        679
## 37-20011231           0          0                       NA        892
## 37-20020331           0          0                      220        200
## 37-20020630           0          0                      435        414
##             domestic_deposits_lagged_1_year totSBloans_Delt
## 37-20010331                              NA              NA
## 37-20010630                              NA              NA
## 37-20010930                              NA              NA
## 37-20011231                              NA              NA
## 37-20020331                           53715              NA
## 37-20020630                           53502              NA
##             totSBloans_Delt_lagged_1_year totNumSBloans_Delt
## 37-20010331                            NA                 NA
## 37-20010630                            NA                 NA
## 37-20010930                            NA                 NA
## 37-20011231                            NA                 NA
## 37-20020331                            NA                 NA
## 37-20020630                            NA                 NA
##             totNumSBloans_Delt_lagged_1 tot_SB_loans_lagged_1_year
## 37-20010331                          NA                         NA
## 37-20010630                          NA                         NA
## 37-20010930                          NA                         NA
## 37-20011231                          NA                         NA
## 37-20020331                          NA                         NA
## 37-20020630                          NA                          0
##             tot_SB_loans_TA_lagged_1 less_100_lagged_SB_loans_TA
## 37-20010331                       NA                          NA
## 37-20010630                       NA                          NA
## 37-20010930                       NA                          NA
## 37-20011231                       NA                          NA
## 37-20020331                       NA                          NA
## 37-20020630                        0                           0
##             X100_250_lagged_SB_loans_TA X250_1000_lagged_SB_loans_TA
## 37-20010331                          NA                           NA
## 37-20010630                          NA                           NA
## 37-20010930                          NA                           NA
## 37-20011231                          NA                           NA
## 37-20020331                          NA                           NA
## 37-20020630                           0                            0
##                     ROA ROA_lagged_1 tot_NPA   tot_NPA_TA tot_NPA_lagged_1
## 37-20010331 0.003359497           NA     103 1.572855e-03               NA
## 37-20010630 0.006648631           NA       0 0.000000e+00               NA
## 37-20010930 0.010354556           NA      84 1.280976e-03               NA
## 37-20011231 0.013388569           NA       5 7.504803e-05               NA
## 37-20020331 0.002908414  0.003359497       0 0.000000e+00              103
## 37-20020630 0.005973681  0.006648631       0 0.000000e+00                0
##             NPA_TA_lagged_1 TD_TA_lagged_1 mdi_ind asian_ind bhn_ind
## 37-20010331              NA             NA       0         0       0
## 37-20010630              NA             NA       0         0       0
## 37-20010930              NA             NA       0         0       0
## 37-20011231              NA             NA       0         0       0
## 37-20020331     0.001572855      0.8202517       0         0       0
## 37-20020630     0.000000000      0.8177358       0         0       0
##             african_am_ind hispanic_ind born_vector de_novo
## 37-20010331              0            0           0       0
## 37-20010630              0            0           0       0
## 37-20010930              0            0           0       0
## 37-20011231              0            0           0       0
## 37-20020331              0            0           0       0
## 37-20020630              0            0           0       0
##             TETA_lagged_1_year fin_crisis_ind post_crisis_ind
## 37-20010331                 NA              0               0
## 37-20010630                 NA              0               0
## 37-20010930                 NA              0               0
## 37-20011231                 NA              0               0
## 37-20020331          0.1744495              0               0
## 37-20020630          0.1764256              0               0

Summary Statistics

First we’ll create some tables of summary statistics to get a better understanding of our data set. Questions we would like to answer are:

For now:

  1. What is the capital structure of the average and median bank?
  2. What is the average proportion of loans of a given type (consumer, C&I, real-estate)—as a percent of assets?
  3. Is bank capital structure different for young firms?
  4. Do young firms focus on one type of loan?
  5. Were capital structures different during/after the financial crisis?
  6. What are the general characteristics of the average and median bank, i.e. ROA, NPAs
library(stargazer)

var <- c("quarter", "totSBloans_Delt", "totNumSBloans_Delt", "t1_LR_lagged_1_year", "tot_SB_loans_TA_lagged_1", "ROA_lagged_1", "NPA_TA_lagged_1", "total_assets_lagged_1_year", "TD_TA_lagged_1", "de_novo", "TETA_lagged_1_year", "post_crisis_ind", "fin_crisis_ind")


panel_vars <- data.frame(panel[, var])

panel_vars <- panel_vars[complete.cases(panel_vars), ]


de_novos <- subset(panel_vars, de_novo == 1)

not_de_novos <- subset(panel_vars, de_novo == 0)

## create tables with stargazer

stargazer(de_novos[, -1], type = "html", title="Descriptive Statistics: De Novo Banks", digits=3, out="html", covariate.labels = c("% Change Amt. S. Bus. Loans", "% Change Num. S. Bus. Loans", "Tier 1 Leverage Ratio", "Small-Business Loans", "ROA", "NPA", "Total Assets", "Deposits", "De Novo", "Total Equity", "Post Crisis", "Financial Crisis"))
Descriptive Statistics: De Novo Banks
Statistic N Mean St. Dev. Min Pctl(25) Pctl(75) Max
% Change Amt. S. Bus. Loans 12,813 0.451 4.493 -1.000 -0.099 0.303 326.410
% Change Num. S. Bus. Loans 12,813 0.523 7.257 -1.000 -0.079 0.306 703.488
Tier 1 Leverage Ratio 12,813 0.161 0.243 -0.052 0.097 0.161 12.307
Small-Business Loans 12,813 0.046 0.059 0.000 0.005 0.065 0.633
ROA 12,813 -0.001 0.012 -0.244 -0.002 0.004 0.237
NPA 12,813 0.001 0.004 0 0 0.001 0
Total Assets 12,813 810,306.200 3,988,093.000 3,350 66,654 331,980 119,678,000
Deposits 12,813 0.788 0.115 0.000 0.750 0.864 1.016
De Novo 12,813 1.000 0.000 1 1 1 1
Total Equity 12,813 0.149 0.100 -0.052 0.099 0.160 1.000
Post Crisis 12,813 0.589 0.492 0 0 1 1
Financial Crisis 12,813 0.163 0.369 0 0 0 1
stargazer(not_de_novos[, -1], type = "html", title="Descriptive Statistics: Not De Novo Banks", digits=3, out="html", covariate.labels = c("% Change Amt. S. Bus. Loans", "% Change Num. S. Bus. Loans", "Tier 1 Leverage Ratio", "Small-Business Loans", "ROA", "NPA", "Total Assets", "Deposits", "De Novo", "Total Equity", "Post Crisis", "Financial Crisis"))
Descriptive Statistics: Not De Novo Banks
Statistic N Mean St. Dev. Min Pctl(25) Pctl(75) Max
% Change Amt. S. Bus. Loans 198,030 -0.003 1.104 -1 -0.1 0.1 249
% Change Num. S. Bus. Loans 198,030 0.019 7.877 -1 -0.1 0.1 2,189
Tier 1 Leverage Ratio 198,030 0.103 0.034 -0.098 0.085 0.113 1.575
Small-Business Loans 198,030 0.064 0.051 0.000 0.031 0.083 0.978
ROA 198,030 0.004 0.008 -0.335 0.002 0.007 0.240
NPA 198,030 0.003 0.005 0.000 0.0001 0.003 0.287
Total Assets 198,030 535,806.300 2,538,888.000 2,190 88,650 372,096 157,935,238
Deposits 198,030 0.837 0.070 0.00003 0.807 0.884 1.101
De Novo 198,030 0.000 0.000 0 0 0 0
Total Equity 198,030 0.107 0.035 -0.118 0.088 0.119 0.965
Post Crisis 198,030 0.450 0.498 0 0 1 1
Financial Crisis 198,030 0.175 0.380 0 0 0 1

Analyses

The Change in Small Business Loans

panel <- panel[, var]

panel <- panel[complete.cases(panel), ]

## orthogonalize TE

TE_ortho <- lm(panel$TETA_lagged_1_year ~ panel$t1_LR_lagged_1_year)$resid

FEmodel1 <- plm(totSBloans_Delt ~  t1_LR_lagged_1_year + TE_ortho + tot_SB_loans_TA_lagged_1 + ROA_lagged_1 + NPA_TA_lagged_1 + I(log(panel$total_assets_lagged_1_year)) + TD_TA_lagged_1 + post_crisis_ind + fin_crisis_ind, data = panel, model = "within", effect = "individual")

## summary(FEmodel1)

FEmodel2 <- plm(totSBloans_Delt ~  t1_LR_lagged_1_year + TE_ortho + tot_SB_loans_TA_lagged_1 + ROA_lagged_1 + NPA_TA_lagged_1 + I(log(panel$total_assets_lagged_1_year))  + TD_TA_lagged_1 + post_crisis_ind + fin_crisis_ind + I(log(panel$total_assets_lagged_1_year) * ROA_lagged_1), data = panel, model = "within", effect = "individual")

## summary(FEmodel3)
## add de novo

stargazer(FEmodel1, FEmodel2, covariate.labels = c("T1LR", "TE", "Small Business Loans", "ROA", "NPA", "ln(TA)", "Deposits", "Post Crisis", "Fin Crisis", "ln(TA) * ROA", "ln(TA) * NPA"), dep.var.labels = "% Change in Amt. SB Loans", digits = 3, no.space=TRUE, header=FALSE, type='html', omit.stat=c("LL"), title = "All Banks: Determinants of the % Change in the Amount of Small-Business Loans", out = "html", intercept.bottom = TRUE, notes = "Results are from fixed-effects models with bank fixed effects, for the years 2001 through 2017.  Data are quarterly.  The dependent variable is percent change in the amount of small-business loans.  Small-Business loans are defined as the sum of commercial, industrial, and commercial real-estate loans.  All variables are lagged one year relative to the dependent variable.")
All Banks: Determinants of the % Change in the Amount of Small-Business Loans
Dependent variable:
% Change in Amt. SB Loans
(1) (2)
T1LR 6.439*** 6.335***
(0.071) (0.072)
TE 2.278*** 2.080***
(0.173) (0.176)
Small Business Loans -3.419*** -3.416***
(0.125) (0.125)
ROA -1.965*** -31.128***
(0.499) (4.288)
NPA -1.544* -1.445*
(0.815) (0.815)
ln(TA) -0.459*** -0.464***
(0.011) (0.011)
Deposits -1.197*** -1.188***
(0.098) (0.098)
Post Crisis 0.036*** 0.035***
(0.008) (0.008)
Fin Crisis 0.013 0.016*
(0.010) (0.010)
ln(TA) * ROA 2.454***
(0.358)
Observations 210,843 210,843
R2 0.093 0.094
Adjusted R2 0.049 0.050
F Statistic 2,300.083*** (df = 9; 201095) 2,075.236*** (df = 10; 201094)
Note: p<0.1; p<0.05; p<0.01
Results are from fixed-effects models with bank fixed effects, for the years 2001 through 2017. Data are quarterly. The dependent variable is percent change in the amount of small-business loans. Small-Business loans are defined as the sum of commercial, industrial, and commercial real-estate loans. All variables are lagged one year relative to the dependent variable.

Can We Predict A Financial Crisis?

library(pglm)

summary(pglm(fin_crisis_ind ~ NPA_TA_lagged_1 + ROA_lagged_1, data = panel, family = binomial('probit')))
## --------------------------------------------
## Maximum Likelihood estimation
## Newton-Raphson maximisation, 5 iterations
## Return code 1: gradient close to zero
## Log-Likelihood: -95437.61 
## 4  free parameters
## Estimates:
##                   Estimate Std. error t value Pr(> t)    
## (Intercept)     -8.973e-01  3.904e-03 -229.86  <2e-16 ***
## NPA_TA_lagged_1  1.179e+01  5.634e-01   20.93  <2e-16 ***
## ROA_lagged_1    -2.134e+01  3.819e-01  -55.88  <2e-16 ***
## sigma            1.748e-11  8.040e-03    0.00       1    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------

Graphics

library(highcharter)

chart_data <- subset(de_novos, quarter == 20050630)

hchart(de_novos, "bubble", hcaes(x = totSBloans_Delt, y = t1_LR_lagged_1_year, size = total_assets_lagged_1_year, color = NPA_TA_lagged_1)) %>%
    hc_add_theme(hc_theme_flatdark())